Skip to content

Conversation

alexhegit
Copy link

No description provided.

@wutaijieing
Copy link

wutaijieing commented May 24, 2025

requirements.txt里面的onnxruntime-gpu需要更改或移除吗,amd有专属的onnxruntime-rocm
https://rocm.docs.amd.com/projects/radeon/en/latest/docs/install/native_linux/install-onnx.html

@alexhegit
Copy link
Author

requirements.txt里面的onnxruntime-gpu需要更改或移除吗,amd有专属的onnxruntime-rocm https://rocm.docs.amd.com/projects/radeon/en/latest/docs/install/native_linux/install-onnx.html

我尝试使用onnxruntime-rocm,但是运行失败了。所以,对于AMD GPU只能使用onnxruntime。 (也不可以使用onnxruntime-gpu)

···
(cosyvoice) amd@AIG-PM:/DATA/ws/CosyVoice$ python3 webui.py --port 50000 --model_dir pretrained_models/CosyVoice-300M
Traceback (most recent call last):
File "/home/amd/anaconda3/envs/cosyvoice/lib/python3.10/pydoc.py", line 439, in safeimport
module = import(path)
File "/DATA/ws/CosyVoice/cosyvoice/flow/flow_matching.py", line 17, in
from matcha.models.components.flow_matching import BASECFM
File "/DATA/ws/CosyVoice/third_party/Matcha-TTS/matcha/models/components/flow_matching.py", line 7, in
from matcha.utils.pylogger import get_pylogger
File "/DATA/ws/CosyVoice/third_party/Matcha-TTS/matcha/utils/init.py", line 1, in
from matcha.utils.instantiators import instantiate_callbacks, instantiate_loggers
File "/DATA/ws/CosyVoice/third_party/Matcha-TTS/matcha/utils/instantiators.py", line 4, in
from lightning import Callback
File "/home/amd/anaconda3/envs/cosyvoice/lib/python3.10/site-packages/lightning/init.py", line 21, in
from lightning.pytorch.callbacks import Callback # noqa: E402
File "/home/amd/anaconda3/envs/cosyvoice/lib/python3.10/site-packages/lightning/pytorch/init.py", line 27, in
from lightning.pytorch.callbacks import Callback # noqa: E402
File "/home/amd/anaconda3/envs/cosyvoice/lib/python3.10/site-packages/lightning/pytorch/callbacks/init.py", line 14, in
from lightning.pytorch.callbacks.batch_size_finder import BatchSizeFinder
File "/home/amd/anaconda3/envs/cosyvoice/lib/python3.10/site-packages/lightning/pytorch/callbacks/batch_size_finder.py", line 26, in
from lightning.pytorch.callbacks.callback import Callback
File "/home/amd/anaconda3/envs/cosyvoice/lib/python3.10/site-packages/lightning/pytorch/callbacks/callback.py", line 22, in
from lightning.pytorch.utilities.types import STEP_OUTPUT
File "/home/amd/anaconda3/envs/cosyvoice/lib/python3.10/site-packages/lightning/pytorch/utilities/types.py", line 41, in
from torchmetrics import Metric
File "/home/amd/.local/lib/python3.10/site-packages/torchmetrics/init.py", line 30, in
from torchmetrics import functional # noqa: E402
File "/home/amd/.local/lib/python3.10/site-packages/torchmetrics/functional/init.py", line 14, in
from torchmetrics.functional.audio._deprecated import _permutation_invariant_training as permutation_invariant_training
File "/home/amd/.local/lib/python3.10/site-packages/torchmetrics/functional/audio/init.py", line 62, in
from torchmetrics.functional.audio.dnsmos import deep_noise_suppression_mean_opinion_score
File "/home/amd/.local/lib/python3.10/site-packages/torchmetrics/functional/audio/dnsmos.py", line 29, in
from onnxruntime import InferenceSession
ImportError: cannot import name 'InferenceSession' from 'onnxruntime' (unknown location)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/DATA/ws/CosyVoice/webui.py", line 188, in
cosyvoice = CosyVoice(args.model_dir)
File "/DATA/ws/CosyVoice/cosyvoice/cli/cosyvoice.py", line 39, in init
configs = load_hyperpyyaml(f)
File "/home/amd/.local/lib/python3.10/site-packages/hyperpyyaml/core.py", line 188, in load_hyperpyyaml
hparams = yaml.load(yaml_stream, Loader=loader)
File "/home/amd/anaconda3/envs/cosyvoice/lib/python3.10/site-packages/yaml/init.py", line 81, in load
return loader.get_single_data()
File "/home/amd/.local/lib/python3.10/site-packages/ruamel/yaml/constructor.py", line 116, in get_single_data
return self.construct_document(node)
File "/home/amd/.local/lib/python3.10/site-packages/ruamel/yaml/constructor.py", line 120, in construct_document
data = self.construct_object(node)
File "/home/amd/.local/lib/python3.10/site-packages/ruamel/yaml/constructor.py", line 147, in construct_object
data = self.construct_non_recursive_object(node)
File "/home/amd/.local/lib/python3.10/site-packages/ruamel/yaml/constructor.py", line 188, in construct_non_recursive_object
for _dummy in generator:
File "/home/amd/.local/lib/python3.10/site-packages/ruamel/yaml/constructor.py", line 633, in construct_yaml_map
value = self.construct_mapping(node)
File "/home/amd/.local/lib/python3.10/site-packages/ruamel/yaml/constructor.py", line 429, in construct_mapping
return BaseConstructor.construct_mapping(self, node, deep=deep)
File "/home/amd/.local/lib/python3.10/site-packages/ruamel/yaml/constructor.py", line 244, in construct_mapping
value = self.construct_object(value_node, deep=deep)
File "/home/amd/.local/lib/python3.10/site-packages/ruamel/yaml/constructor.py", line 147, in construct_object
data = self.construct_non_recursive_object(node)
File "/home/amd/.local/lib/python3.10/site-packages/ruamel/yaml/constructor.py", line 183, in construct_non_recursive_object
data = constructor(self, tag_suffix, node)
File "/home/amd/.local/lib/python3.10/site-packages/hyperpyyaml/core.py", line 480, in _construct_object
args, kwargs = _load_node(loader, node)
File "/home/amd/.local/lib/python3.10/site-packages/hyperpyyaml/core.py", line 434, in _load_node
kwargs = loader.construct_mapping(node, deep=True)
File "/home/amd/.local/lib/python3.10/site-packages/ruamel/yaml/constructor.py", line 429, in construct_mapping
return BaseConstructor.construct_mapping(self, node, deep=deep)
File "/home/amd/.local/lib/python3.10/site-packages/ruamel/yaml/constructor.py", line 244, in construct_mapping
value = self.construct_object(value_node, deep=deep)
File "/home/amd/.local/lib/python3.10/site-packages/ruamel/yaml/constructor.py", line 147, in construct_object
data = self.construct_non_recursive_object(node)
File "/home/amd/.local/lib/python3.10/site-packages/ruamel/yaml/constructor.py", line 183, in construct_non_recursive_object
data = constructor(self, tag_suffix, node)
File "/home/amd/.local/lib/python3.10/site-packages/hyperpyyaml/core.py", line 470, in construct_object
callable
= pydoc.locate(callable_string)
File "/home/amd/anaconda3/envs/cosyvoice/lib/python3.10/pydoc.py", line 1719, in locate
nextmodule = safeimport('.'.join(parts[:n+1]), forceload)
File "/home/amd/anaconda3/envs/cosyvoice/lib/python3.10/pydoc.py", line 454, in safeimport
raise ErrorDuringImport(path, sys.exc_info())
pydoc.ErrorDuringImport: problem in cosyvoice.flow.flow_matching - ImportError: cannot import name 'InferenceSession' from 'onnxruntime' (unknown location)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/DATA/ws/CosyVoice/webui.py", line 191, in
cosyvoice = CosyVoice2(args.model_dir)
File "/DATA/ws/CosyVoice/cosyvoice/cli/cosyvoice.py", line 154, in init
configs = load_hyperpyyaml(f, overrides={'qwen_pretrain_path': os.path.join(model_dir, 'CosyVoice-BlankEN')})
File "/home/amd/.local/lib/python3.10/site-packages/hyperpyyaml/core.py", line 157, in load_hyperpyyaml
yaml_stream = resolve_references(yaml_stream, overrides, overrides_must_match)
File "/home/amd/.local/lib/python3.10/site-packages/hyperpyyaml/core.py", line 316, in resolve_references
recursive_update(preview, overrides, must_match=overrides_must_match)
File "/home/amd/.local/lib/python3.10/site-packages/hyperpyyaml/core.py", line 778, in recursive_update
raise KeyError(f"Override '{k}' not found in: {[key for key in d.keys()]}")
KeyError: "Override 'qwen_pretrain_path' not found in: ['__set_seed1', '__set_seed2', '__set_seed3', '__set_seed4', 'sample_rate', 'text_encoder_input_size', 'llm_input_size', 'llm_output_size', 'spk_embed_dim', 'llm', 'flow', 'hift', 'parquet_opener', 'get_tokenizer', 'allowed_special', 'tokenize', 'filter', 'resample', 'feat_extractor', 'compute_fbank', 'parse_embedding', 'shuffle', 'sort', 'batch', 'padding', 'data_pipeline', 'train_conf']"

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/DATA/ws/CosyVoice/webui.py", line 193, in
raise TypeError('no valid model_type!')
TypeError: no valid model_type!

···

Force to use onnxruntime for AMD GPU.
Copy link
Author

@alexhegit alexhegit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refine the patch to force use onnxruntime for AMD GPU.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants